//
//  ProductListHeaderView.m
//  TestPrj
//
//  Created by 朱铅峰 on 2020/6/22.
//  Copyright © 2020 Xing. All rights reserved.
//

#import "ProductListHeaderView.h"
#import <Masonry.h>

@interface ProductListHeaderView()

proStrong UILabel *titleLabel;

@end

@implementation ProductListHeaderView

+ (CGFloat)viewHeight {
    
    return 24;
}

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        [self addviews];
    }
    return self;
}

- (void)addviews {
    
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = [UIColor redColor];
    [self addSubview:line];
    
    self.titleLabel = [Utils genLabelWithFrame:CGRectZero textAlign:NSTextAlignmentLeft fontSize:12 textColor:kColorBlack];
    [self addSubview:self.titleLabel];
    
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.width.mas_equalTo(2);
        make.height.mas_equalTo(14);
        make.centerY.equalTo(self);
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(line.mas_right).offset(5);
        make.right.mas_equalTo(-10);
        make.top.bottom.mas_equalTo(0);
    }];
}

- (void)layoutSubviews {
    
    self.backgroundView.backgroundColor = kColorLineColor;
}

- (void)loadData:(NSString *)title {
    
    self.titleLabel.text = title;
}

@end
